package com.hyj.ecp.backstage.sys.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hyj.ecp.backstage.sys.bean.qo.ConfigQO;
import com.hyj.ecp.backstage.sys.bean.qo.LoginQO;
import com.hyj.ecp.backstage.sys.bean.vo.User;
import com.hyj.ecp.backstage.sys.service.IEcpLoginService;
import com.hyj.ecp.common.dao.IjdbcDAO;
import com.hyj.ecp.common.dao.ImybatisDAO;


@Service
public class EcpLoginService implements IEcpLoginService {

	@Autowired
    private IjdbcDAO dao;
	
	@Resource(name="sqlSession")
    public  SqlSessionTemplate sqlSession;
	
	@Override
	public User login(LoginQO qo) {
		User u = (User) sqlSession.selectOne(
	            "com.ecp.backstage.sys.login.getUser",qo);
		
		return u;
	}

	@Override
	public List<Map<String, Object>> queryMenue(LoginQO qo) {
		List<Map<String, Object>> u =  sqlSession.selectList(
	            "com.ecp.backstage.sys.login.queryMunue",qo);
		return u;
	}

	@Override
	public int updatePassword(LoginQO qo) {
		return sqlSession.update("com.ecp.backstage.sys.login.modifyPassword", qo);
	}

	@Override
	public int updateConfig(ConfigQO qo) {
		return sqlSession.update("com.ecp.backstage.sys.login.updateSysConfig", qo);
	}

	@Override
	public ConfigQO queryConfig(ConfigQO qo) {
		return sqlSession.selectOne("com.ecp.backstage.sys.login.queryConfig", qo);
	}

}
